import request from '../utills/request'

/**
 * 登录请求，用于用户登录
 * @param {string} mobile 手机号
 * @param {string} code 验证码
 * @returns 返回Promise
 */
export const login = (mobile, code) => {
  return request.post('/v1_0/authorizations', {
    mobile,
    code,
  })
}

/**
 * 获取用户个人信息
 * @returns
 */
export const getInfo = () => {
  return request.get('/v1_0/user/profile')
}

/**
 * 修改个人信息
 * @param {*} name
 * @param {*} gender
 * @param {*} birthday
 * @param {*} real_name
 * @param {*} intro
 * @returns
 */
export const setInfo = (name, gender, birthday, real_name, intro) => {
  return request.patch('/v1_0/user/profile', {
    name,
    gender,
    birthday,
    real_name,
    intro,
  })
}
